package com.taobao.tbk.response;

public class CommonResponse {
    private String status;
    private Object data;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    /**
     * 通用回复结构无异常的构造器
     * @param data  回复数据
     * @return      回复结构体
     */
    public static CommonResponse create(Object data) {
        return CommonResponse.create("success", data);
    }

    /**
     * 通用回复结构构造器
     * @param status    状态码：1、success   2、error
     * @param data      返回信息结构体
     * @return          通用回复结构
     */
    public static CommonResponse create(String status, Object data) {
        CommonResponse commonResponse = new CommonResponse();
        commonResponse.setStatus(status);
        commonResponse.setData(data);
        return commonResponse;
    }
}
